﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
    Inherits="masterdata_Warehouse_Locations_List" CodeFile="Warehouse_List.aspx.cs" %>

<%@ Register Src="~/UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>仓库列表 </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(function () {
            var dlg = $('#dd').dialog({
                title: '仓库维护',
                iconCls: 'icon-ok',
                closed: true,
                buttons: [{
                    text: '保存',
                    handler: function () {
                        $get('<%=btnSave.ClientID %>').click();
                    }
                }, {
                    text: '取消',
                    handler: function () {
                        $('#dd').dialog('close');
                    }
                }]
            });
            dlg.parent().appendTo(jQuery("form:first"));
        });
        function open1() {
            $('#dd').dialog('open');
        }
        function close1() {
            $('#dd').dialog('close');
        }
    </script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div>
                <table id="wsd_listtable" width="100%">
                    <tr>
                        <td style="width: 100%">
                            <asp:GridView Width="100%" ID="GridView1" runat="server" AutoGenerateColumns="False"
                                EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                                BorderWidth="0" OnRowDataBound="Grid_RowDataBound" EnableEmptyContentRender="true"
                                AllowPaging="True" DataKeyNames="ID" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                                PageSize="15">
                                <HeaderStyle CssClass="titlist" />
                                <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                                <Columns>
                                    <asp:TemplateField HeaderText="仓库代码" ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton1" Text='<%#Eval("Code")%>' runat="server"
                                                OnClientClick="open1();" CommandName="Select" CssClass="btn3_mouseover" CausesValidation="false" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="仓库名称" ItemStyle-Width="20%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton2" Text='<%#Eval("DESCRIPTION")%>' runat="server" OnClientClick="open1();"
                                                CommandName="Select" CssClass="btn3_mouseover" CausesValidation="false" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="发货区域" DataField="DEPARTUREDISTRIBUTIONAREA" ItemStyle-Width="25%" />
                                    <asp:TemplateField HeaderText="有效" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center">
                                        <ItemTemplate>
                                            <b>
                                                <%# (bool)Eval("ACTIVE") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%></b>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="分配产品" ItemStyle-Width="20%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="btnAddDictate" Text="分配产品" runat="server" CssClass="btn3_mouseover"
                                                PostBackUrl='<%#"Customer_Product_Choose.aspx?id="+Eval("ID") %>' CausesValidation="false" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle CssClass="evenline" />
                                <AlternatingRowStyle CssClass="oddline" />
                                <PagerSettings Visible="false" FirstPageText="首页" LastPageText="尾页" Mode="NumericFirstLast"
                                    PageButtonCount="30" />
                            </asp:GridView>
                            <uc1:GridPager ID="GridPager1" runat="server" Visible="false" />
                        </td>
                    </tr>
                </table>
                <br />
                <table id="wsd_inputtable">
                  
                       <tr>
                            <td class="tabletitle" width="100%">
                                操作选项
                            </td>
                        </tr>
                        <tr>
                            <td class="buttonarea">
                                <asp:Button ID="btnAdd" runat="server" class="wsd_button2" OnClick="btnAdd_Click"
                                    OnClientClick="open1()" CausesValidation="false" Text="新  增" />
                            </td>
                        </tr>
                   
                </table>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <div style="width: 400px; height: 250px;" id="dd" icon="icon-save">
        <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <table style="width: 100%">
                    <tr>
                        <td style="width: 100%">
                            <font color="red" size="2"><b>提示:*为必填项</b></font>&nbsp;&nbsp;
                        </td>
                        <td class="tabletitle">
                            <asp:ImageButton ID="ImageButton1" BorderStyle="Solid" runat="server" CausesValidation="false"
                                Height="0" Width="0" OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
                <table id="wsd_inputtable" style="width: 100%;border:0px; ">
                    <tr>
                        <td>
                            <center>
                                <asp:DetailsView CssClass="wsd_inputtable" ID="DetailsView1" runat="server" BorderWidth="0"
                                    AutoGenerateRows="False" DataSourceID="ObjectDataSource1" DefaultMode="Insert"
                                    BorderStyle="None" GridLines="None" OnDataBound="DetailsView1_DataBound">
                                    
                                    <Fields>
                                        <asp:TemplateField HeaderText="仓库代码:<font color=red>*</font>">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtCode" runat="server" MaxLength="20" Text='<%# Bind("Code") %>'></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="仓库不能为空"
                                                    ControlToValidate="txtCode" Display="Dynamic"></asp:RequiredFieldValidator>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="仓库名称:<font color=red>*</font>">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("DESCRIPTION") %>' MaxLength="20"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="仓库不能为空"
                                                    ControlToValidate="txtName" Display="Dynamic"></asp:RequiredFieldValidator>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="发货区域:<font color=red>*</font>">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtArea" runat="server" Text='<%# Bind("DEPARTUREDISTRIBUTIONAREA") %>' MaxLength="20"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="发货区域不能为空"
                                                    ControlToValidate="txtArea" Display="Dynamic"></asp:RequiredFieldValidator>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="有效:">
                                            <ItemTemplate>
                                                <asp:CheckBox runat="server" ID="chkValid" Checked='<%# Bind("ACTIVE") %>'  />
                                            </ItemTemplate>
                                            
                                        </asp:TemplateField>
                                    </Fields>
                                    <RowStyle CssClass="tablefield" />
                                </asp:DetailsView>
                                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.SHIP_FROM_LOCATIONS"
                                    InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.MasterData.WareHouseManager"
                                    UpdateMethod="Save">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="GridView1" DefaultValue="" Name="ID" PropertyName="SelectedValue"
                                            Type="Int32" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                                <center />
                        </td>
                    </tr>
                </table>
                <div style="display: none;">
                    <table id="wsd_inputtable" style="width: 100%">
                        <tr>
                            <td height="10px" width="100%" class="tabletitle">
                                操作选项
                            </td>
                        </tr>
                        <tr>
                            <td class="buttonarea">
                                <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保  存" OnClick="btnSave_Click" />
                                &nbsp;&nbsp;
                                <asp:Button ID="btnCancel" runat="server" class="wsd_button2" Text="取  消" CausesValidation="false"
                                    OnClick="btnCancel_Click" />
                            </td>
                        </tr>
                    </table>
                </div>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
